package main

import (
	"fmt"
	"sync"
	"time"
)

var wg sync.WaitGroup

func sayHello() {
	for i := 0; i < 10; i++ {
		fmt.Println("Hello, world!")
		time.Sleep(time.Millisecond * 150)
	}
	wg.Done()
}

func main() {
	wg.Add(1)
	go sayHello()
	for i := 0; i < 5; i++ {
		fmt.Println("main thread", i)
		time.Sleep(time.Millisecond * 100)
	}
	wg.Wait()
}
